Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation_looped signal to AnimationMixer #89525

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Mar 15, 2024

The signal has two parameters: the animation name, and a boolean that is true if the looping barrier was crossed backwards (which occurs when playing backwards or with ping-pong looping), false otherwise.

This is available in both AnimationPlayer and AnimationTree. In AnimationTree, this is implemented in AnimationNodeAnimation.

For reference, AnimatedSprite2D/3D have similar signals available, although they don't have an anim_name and backwards parameters.

Testing project: test_animation_looped_signal.zip

@Calinou Calinou added this to the 4.x milestone Mar 15, 2024
@Calinou Calinou requested review from a team as code owners March 15, 2024 16:33
@Calinou Calinou force-pushed the animationplayer-add-looped-signal branch from 11647ee to 3a23f3e Compare March 15, 2024 16:39
@valkyrienyanko
Copy link

valkyrienyanko commented Mar 16, 2024

I tried building from this PR but whenever I open a blank new project it only opens 50% of the time. The other 50% of the time it will immediately crash to desktop upon opening with the following logged to the console. It does not matter if the project is Forward+ or Compatibility. The project will crash 50% of the time either way.

C:\Users\VALK-DESKTOP\Documents\Godot Projects\Godot\bin>godot.windows.editor.x86_64.mono.console.exe
Godot Engine v4.3.dev.mono.custom_build.3a23f3eda (2024-03-15 16:39:11 UTC) - https://godotengine.org
OpenGL API 3.3.0 Core Profile Context 24.2.1.240215 - Compatibility - Using Device: ATI Technologies Inc. - AM0

Editing project: C:/Users/VALK-DESKTOP/Documents/_Godot Projects/test2
Godot Engine v4.3.dev.mono.custom_build.3a23f3eda (2024-03-15 16:39:11 UTC) - https://godotengine.org
OpenGL API 3.3.0 Core Profile Context 24.2.1.240215 - Compatibility - Using Device: ATI Technologies Inc. - AM0


================================================================
CrashHandlerException: Program crashed
Engine version: Godot Engine v4.3.dev.mono.custom_build (3a23f3eda4f5e3236ec337d0614849327a5e622a)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[0] <couldn't map PC to fn name>
[1] <couldn't map PC to fn name>
[2] <couldn't map PC to fn name>
[3] <couldn't map PC to fn name>
[4] <couldn't map PC to fn name>
[5] <couldn't map PC to fn name>
[6] <couldn't map PC to fn name>
[7] <couldn't map PC to fn name>
[8] <couldn't map PC to fn name>
[9] <couldn't map PC to fn name>
[10] <couldn't map PC to fn name>
[11] <couldn't map PC to fn name>
[12] <couldn't map PC to fn name>
[13] <couldn't map PC to fn name>
[14] <couldn't map PC to fn name>
[15] <couldn't map PC to fn name>
[16] <couldn't map PC to fn name>
[17] <couldn't map PC to fn name>
[18] <couldn't map PC to fn name>
[19] <couldn't map PC to fn name>
-- END OF BACKTRACE --
================================================================

On another launch attempt in --verbose I found this warning in the logs. Not sure if this is helpful or not.

WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
        windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
        Objects - 1
                Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 2396889292336
 O r p h aant :S trRienngdNearmineg:C oIntteemxLtiDsrti v(esrtVautlikca:n :1:,_ dteobtuagl_:m e9s)s
enOgreprh_acna lSltbraicnkg N(admrei:v eTresx\tvuurlek2aDn \(rsetnadteirci:n g0_,c otnotteaxlt:_ d2r)i
veOrr_pvhualnk aSnt.rcipnpg:N3a0m1e):
 PopupMenu (static: 1, total: 15)

On another launch attempt without --verbose I got this when it crashed

Fatal error. Internal CLR error. (0x80131506)

If this is helpful here is my dotnet --info

.NET SDK:
 Version:   7.0.203
 Commit:    5b005c19f5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22631
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.203\

Host:
  Version:      7.0.5
  Architecture: x64
  Commit:       8042d61b17

.NET SDKs installed:
  3.1.426 [C:\Program Files\dotnet\sdk]
  6.0.127 [C:\Program Files\dotnet\sdk]
  6.0.202 [C:\Program Files\dotnet\sdk]
  6.0.400 [C:\Program Files\dotnet\sdk]
  7.0.203 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

@Calinou
Copy link
Member Author

Calinou commented Mar 18, 2024

@valkyrienyanko Given the --verbose message, this sounds like #84205 (which would also affect you with an official build). Try compiling with debug_symbols=yes so you can see an useful crash backtrace when running Godot.

That said, Vulkan isn't being initialized at all when you open the project manager1 or when you open a project that uses the Compatibility rendering method. Can you reproduce this with a non-.NET build?

Footnotes

  1. The project manager always uses the Compatibility rendering method, unless forced to use a different rendering method with the --rendering-method command line argument.

The signal has two parameters: the animation name, and a boolean
that is `true` if the looping barrier was crossed backwards
(which occurs when playing backwards or with ping-pong looping),
`false` otherwise.

This is available in both AnimationPlayer and AnimationTree.
In AnimationTree, this is implemented in AnimationNodeAnimation.
@Calinou Calinou force-pushed the animationplayer-add-looped-signal branch from 3a23f3e to bce985a Compare May 7, 2024 19:04
@Calinou
Copy link
Member Author

Calinou commented May 7, 2024

Rebased and tested again, it mostly works as expected.

  • AnimationTree now uses the backward playback mode correctly, so the signal parameter emitted is inverted when the playback mode is backward.

I've tried applying the same to AnimationPlayer, but it doesn't seem to be working (try an AnimationPlayer with a playback speed scale of -1.0). Also, I noticed that when using a negative playback speed scale, animation_looped is emitted immediately after the animation starts playing, likely because the time is set to 0.0 on startup instead of being set to the animation's end duration. (I use Autoplay to check this.)

@TokageItLab
Copy link
Member

TokageItLab commented May 8, 2024

I've been asked several times that the combination of negative timescale and play() in AnimationPlayer is certainly a bit confusing. Perhaps we need to hide the from_end argument and make it consistent so that the starting position changes depending on the final timescale?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnimationTree`s animation started event notification bug (does not work with looped animations)
4 participants